package com.tom.architect.day07;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;

import com.tom.architect.R;


public class MainActivity7 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main7);
        findViewById(R.id.textView);


        new Thread() {
            @Override
            public void run() {
                Looper.prepare();
                // java.lang.RuntimeException: Can't create handler inside thread Thread[Thread-2,5,main] that has not called Looper.prepare()
                Handler handler = new Handler();
                handler.sendMessage(Message.obtain());
                Looper.loop();
            }
        }.start();
    }
}

